package com.xiaoxu.common.config;

import com.xiaoxu.common.interceptor.UserLoginAuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Component
public class UserWebMvcConfiguration implements WebMvcConfigurer {
    //拦截器
    @Autowired
    private UserLoginAuthInterceptor userLoginAuthInterceptor ;
    //拦截所有的前端以api开头的路径请求
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userLoginAuthInterceptor)
                .addPathPatterns("/api/**");
    }
}
